package com.sky.api.client;

import com.sky.dto.GoodsSalesDTO;
import com.sky.result.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@FeignClient("order-service")
public interface OrderClient {
    /**
     * =====================
     * 根据动态条件统计营业额
     *
     * @param map
     */
    @GetMapping("/admin/order/turnover")
    @ApiOperation("根据动态条件统计营业额")
    Result<Double> sumByMap(@RequestBody Map<String, Double> map);

    /**
     * ==========
     * 根据动态条件统计订单数量
     *
     * @param map
     */
    @GetMapping("/admin/order/count")
    @ApiOperation("根据动态条件统计订单数量")
    public Integer countByMap(@RequestBody Map map);

    /**
     * ===================
     * 查询商品销量排名
     *
     * @param begin
     * @param end
     */
    @GetMapping("/admin/order/sales/top10")
    public List<GoodsSalesDTO> getSalesTop10(
            @RequestParam LocalDateTime begin,
            @RequestParam LocalDateTime end);

}